import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *

testCase = "dbshopST015_后台添加前台侧边设置"
# 1.点击“添加侧边设置”按钮，显示名称“网站很好看”，排序255，点击“保存侧边显示信息”。
firefox = openBrowser(urlAdmin)
# 登录后台
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox, "商品管理", "管理分类", "前台侧边设置")
# 点击添加侧边设置
firefox.find_element_by_xpath('//a[@class="btn btn-small btn-primary"]').click()
firefox.find_element_by_id("frontside_name").send_keys("网站很好看")
from selenium.webdriver.common.keys import *  # 导入键盘控件

for i in range(3):
    firefox.find_element_by_id('frontside_sort').send_keys(Keys.BACKSPACE)
firefox.find_element_by_id('frontside_sort').send_keys(255)
firefox.find_element_by_xpath('//button[@class="btn btn-small btn-primary"]').click()
# 2.保存成功信息
lis = firefox.find_elements_by_xpath("//tbody/tr/td[1]")
try:
    for i in lis:
        if "网站很好看" in i.text:
            writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()
